package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysCodingRuleSegmentMapper;
import com.ruoyi.system.domain.SysCodingRuleSegment;
import com.ruoyi.system.service.ISysCodingRuleSegmentService;

/**
 * 编码规则段配置Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-08
 */
@Service
public class SysCodingRuleSegmentServiceImpl implements ISysCodingRuleSegmentService 
{
    @Autowired
    private SysCodingRuleSegmentMapper sysCodingRuleSegmentMapper;

    /**
     * 查询编码规则段配置
     * 
     * @param segmentId 编码规则段配置主键
     * @return 编码规则段配置
     */
    @Override
    public SysCodingRuleSegment selectSysCodingRuleSegmentBySegmentId(Long segmentId)
    {
        return sysCodingRuleSegmentMapper.selectSysCodingRuleSegmentBySegmentId(segmentId);
    }

    /**
     * 查询编码规则段配置列表
     * 
     * @param sysCodingRuleSegment 编码规则段配置
     * @return 编码规则段配置
     */
    @Override
    public List<SysCodingRuleSegment> selectSysCodingRuleSegmentList(SysCodingRuleSegment sysCodingRuleSegment)
    {
        return sysCodingRuleSegmentMapper.selectSysCodingRuleSegmentList(sysCodingRuleSegment);
    }

    /**
     * 新增编码规则段配置
     * 
     * @param sysCodingRuleSegment 编码规则段配置
     * @return 结果
     */
    @Override
    public int insertSysCodingRuleSegment(SysCodingRuleSegment sysCodingRuleSegment)
    {
        sysCodingRuleSegment.setCreateTime(DateUtils.getNowDate());
        return sysCodingRuleSegmentMapper.insertSysCodingRuleSegment(sysCodingRuleSegment);
    }

    /**
     * 修改编码规则段配置
     * 
     * @param sysCodingRuleSegment 编码规则段配置
     * @return 结果
     */
    @Override
    public int updateSysCodingRuleSegment(SysCodingRuleSegment sysCodingRuleSegment)
    {
        sysCodingRuleSegment.setUpdateTime(DateUtils.getNowDate());
        return sysCodingRuleSegmentMapper.updateSysCodingRuleSegment(sysCodingRuleSegment);
    }

    /**
     * 批量删除编码规则段配置
     * 
     * @param segmentIds 需要删除的编码规则段配置主键
     * @return 结果
     */
    @Override
    public int deleteSysCodingRuleSegmentBySegmentIds(Long[] segmentIds)
    {
        return sysCodingRuleSegmentMapper.deleteSysCodingRuleSegmentBySegmentIds(segmentIds);
    }

    /**
     * 删除编码规则段配置信息
     * 
     * @param segmentId 编码规则段配置主键
     * @return 结果
     */
    @Override
    public int deleteSysCodingRuleSegmentBySegmentId(Long segmentId)
    {
        return sysCodingRuleSegmentMapper.deleteSysCodingRuleSegmentBySegmentId(segmentId);
    }
}
